package com.bwie.controller;
import com.bwie.pojo.TUser;
import com.bwie.service.Impl.TUserServiceImpl;
import com.bwie.service.TUserService;
import com.bwie.utils.R;
import com.bwie.vo.LoginFrom;
import com.bwie.vo.PageInfoVo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
* (t_user)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/user/user")
public class TUserController {
/**
* 服务对象
*/
    @Autowired
    private TUserService tUserService;

   @PostMapping("/login")
    public R login(
           @RequestBody LoginFrom loginFrom
           ){
       return tUserService.login(loginFrom);
   }
   @PostMapping("/UserList")
    public R UserList(
           @RequestBody PageInfoVo pageInfoVo
           ){
       return tUserService.UseList(pageInfoVo);
   }
   @PostMapping("/addLogin")
    public R addLogin(
            @RequestBody @Validated TUser tUser
   ){
        return tUserService.addLogin(tUser);
   }
    @PostMapping("/getUser")
    public R getUser(){
       return tUserService.getUser();
    }
    @PostMapping("/getUserRole")
    public R getUserRole(){
       return tUserService.getUserRole();
    }
    @PostMapping("/getTreeList")
    public R getTreeList(){
       return tUserService.getTreeList();
    }

    @PostMapping("/getUserById/{id}")
    public R getUserById(
       @PathVariable("id") Integer id
    ){
       return tUserService.getUserById(id);
    }
}
